# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=opensp
_realname=OpenSP
pkgver=1.5.2
pkgrel=1
pkgdesc="Implementation of the DSSSL style language"
url="http://openjade.sourceforge.net"
arch="all"
license="custom"
makedepends="$depends_dev xmlto"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://prdownloads.sourceforge.net/openjade/$_realname-$pkgver.tar.gz
	opensp-1.5-install.patch
	removed-failing-tests.patch"
builddir="$srcdir"/$_realname-$pkgver

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-static \
		--enable-shared
	make
}

check() {
	make check
}

lang() {
	default_lang
	mkdir -p "$subpkgdir"/usr/share/$pkgname
	mv "$subpkgdir"/usr/share/locale "$subpkgdir"/usr/share/$pkgname
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 "$builddir"/COPYING \
		"$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="
a7dcc246ba7f58969ecd6d107c7b82dede811e65f375b7aa3e683621f2c6ff3e7dccefdd79098fcadad6cca8bb94c2933c63f4701be2c002f9a56f1bbe6b047e  OpenSP-1.5.2.tar.gz
6d4cddb3c98313643ef7ab57ce154dd8a188b7ea8edc608a62ff25e4f995ab4167be94e40c2a62ae568e22e1ada4bd9bf0c9687e4dfa43dafde4d87e8b73fdf8  opensp-1.5-install.patch
4d32af7936193281b621b40a7d8248e61ffb100960a4d07a03b52f47102e8fa47f823d01b059860408cce469404a0cd6f63d4201b976730565a8196872b8d4d3  removed-failing-tests.patch
"
